﻿using System;
using fastCSharp;

namespace diantou.web.question
{
    /// <summary>
    /// 问题首页
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class index : view<index>
    {
        /// <summary>
        /// 被重定向问题
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.question linkQuestion;
        /// <summary>
        /// 显示回答集合
        /// </summary>
        private answer.userAnswer[] showAnswers
        {
            get
            {
                diantou.dataAccess.answer[] answers = diantou.dataAccess.tcpCall.answer.questionAnswers(question.Id, false);
                return answers.getArray(value => new answer.userAnswer { Answer = value, UserId = currentUserId });
            }
        }
        /// <summary>
        /// 是否显示邀请回答
        /// </summary>
        protected override bool isQuestionInvite
        {
            get { return true; }
        }
        /// <summary>
        /// 是否显示答案连接
        /// </summary>
        protected override bool isAnswerPath
        {
            get { return false; }
        }

        /// <summary>
        /// 是否使用智能过滤
        /// </summary>
        private bool isFilter;
        /// <summary>
        /// 是否显示忽略的回答
        /// </summary>
        private bool isIgnoreAnswer;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="questionId"></param>
        /// <param name="linkId">被重定向问题标识</param>
        /// <returns></returns>
        private bool loadView(int questionId, int linkId)
        {
            if (load(questionId))
            {
                if (linkId != 0) linkQuestion = diantou.dataAccess.clientCache.Question[linkId];
                diantou.dataAccess.tcpCall.question.browse(questionId, null);
                return true;
            }
            return false;
        }
    }
}
